package com.nian.common.lock.zookeeper;

import com.nian.common.model.ServerResponse;
import lombok.extern.slf4j.Slf4j;

/**
 * 用途：
 * 开发：zhangmj
 * 日期：2020/4/13 0013 20:30
 */
@Slf4j
public class SimpleZookeepWorker implements IZookeeperLockWorker {

    @Override
    public ServerResponse invoke() {
        try {
            log.info("{} :: 开始执行 SimpleZookeepWorker.invoke ", Thread.currentThread().getName());
            log.info("{} :: 等待 5秒钟...", Thread.currentThread().getName());
            Thread.sleep(20*1000);
            log.info("{} :: 执行完成...", Thread.currentThread().getName());
            return ServerResponse.createBySuccess();
        } catch (InterruptedException e) {
            log.error("SimpleZookeepWorker 处理异常：", e);
        }
        return ServerResponse.createByErrorMessage("SimpleZookeepWorker 处理失败");
    }
}
